<template>
	<!-- minHeight:`${windowHeight}px`, -->
	<!-- <view class="" :style="{ minHeight: `${windowHeight}px`, height: 'auto' }"> -->
	<view class="" style="">
		<!-- minHeight: 300px, height: 'auto' -->
		
		<view v-if="dataInfo.types == 'a'&&  dataInfo.records && dataInfo.records.length> 0  " class="pt-200">

			<view class="shadowClass bgWhite relative ptb-40 mlr-40">
				<view class="closeClass">
					<uv-icon name="close-circle" color="#E1E1E1" size="28"></uv-icon>
				</view>
				<view class="">
					<view class="bgWhite">
						<view class="">
							<view class="Flex">
								<!-- mode="heightFix" -->

								<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" width="300rpx" height="300rpx"
									radius="16rpx"></uv-image>
							</view>

							<view class="Flex pt-40 pb-24">
								<view class="">
									<uv-avatar src="https://via.placeholder.com/200x200.png/2878ff" shape="circle"
										size="60rpx"></uv-avatar>
								</view>
								<view class="ml-20 size-34 bold">Maverick</view>
								<view class="ml-24">
									<uv-image src="/static/images/vip2.png" width="44rpx" height="44rpx"
										mode="scaleToFill"></uv-image>
									<uv-image src="/static/images/vip1.png" width="44rpx" height="44rpx"
										mode="scaleToFill"></uv-image>
								</view>
							</view>
						</view>
						<view class="mt-30 Flex">
							<view class="list_b_btn wd10-40">下载商用 ￥60</view>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view v-else-if="dataInfo.types == 'b' &&  dataInfo.records && dataInfo.records.length> 0  " class="">

			<view v-for="(item, index) in dataInfo.records" :key="index">
				
				<!-- 0:合成中 1:已合成 -->
				<view class="my-creation"
				 
					v-if="item && item.gxdzList && (item.gxdzList[0].generateState == 0 || item.gxdzList[1].generateState == 	0)">
					<view class="my-creation-item" v-if="item.gxdzList && item.gxdzList[0].generateState == 0">
						<view style="border-radius: 10px">
							<view
								style="width: 100%;color: rgb(184,177,178);height:  400rpx;background: rgb(246,246,246);border-radius: 16rpx;display: flex;justify-content: center;align-items: center;">
								正在合成...
							</view>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item.gxdzList[0])" src="/static/images/zhuanfa1.png"
								width="48rpx" height="48rpx"></uv-image>
							<uv-image src="/static/images/shoucang3.png" width="48rpx" height="48rpx"></uv-image>
							<uv-image @click="downloadFile(item.gxdzList[0])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>
					<view class="my-creation-item" v-else>
						<view style="border-radius: 10px" v-if="item.gxdzList && item.gxdzList[0]">
							<uv-image @click="handleImageClick(item.gxdzList[0].synthesisImg)" radius="10rpx"
								style="border-radius: 10px" mode="aspectFill" :src=" item.gxdzList[0].synthesisImg"
								width="100%" height="400rpx"></uv-image>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item.gxdzList[0])" src="/static/images/zhuanfa1.png"
								width="48rpx" height="48rpx"></uv-image>


							<uv-image v-if='item.gxdzList && item.gxdzList[0].isCollect ==1'
								@click="collectFun(item.gxdzList[0])" src="/static/images/shoucang4.png" width="48rpx"
								height="48rpx"></uv-image>
							<uv-image v-else src="/static/images/shoucang3.png" width="48rpx" height="48rpx"
								@click="collectFun(item.gxdzList[0])"></uv-image>
							<uv-image @click="downloadFile(item.gxdzList[0])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>
					<view class="my-creation-item" v-if="item.gxdzList && item.gxdzList[1].generateState == 0">
						<view style="border-radius: 10px">
							<view
								style="width: 100%;color: rgb(184,177,178);height:  400rpx;background: rgb(246,246,246);border-radius: 16rpx;display: flex;justify-content: center;align-items: center;">
								正在合成...
							</view>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item.gxdzList[1])" src="/static/images/zhuanfa1.png"
								width="48rpx" height="48rpx"></uv-image>
							<uv-image src="/static/images/shoucang3.png" width="48rpx" height="48rpx"></uv-image>
							<uv-image @click="downloadFile(item.gxdzList[1])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>
					<view class="my-creation-item" v-else>
						<view v-if="item.gxdzList && item.gxdzList[1]">
							<uv-image @click="handleImageClick(item.gxdzList[1].synthesisImg)" radius="10rpx"
								style="border-radius: 10px" mode="aspectFill" :src=" item.gxdzList[1].synthesisImg"
								width="100%" height="400rpx"></uv-image>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item)" src="/static/images/zhuanfa1.png" width="48rpx"
								height="48rpx"></uv-image>
							<uv-image v-if='item.gxdzList && item.gxdzList[1].isCollect == 1'
								@click="collectFun(item.gxdzList[1])" src="/static/images/shoucang4.png" width="48rpx"
								height="48rpx"></uv-image>
							<uv-image v-else src="/static/images/shoucang3.png" width="48rpx" height="48rpx"
								@click="collectFun(item.gxdzList[1])"></uv-image>

							<uv-image @click="downloadFile(item.gxdzList[1])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>
				</view>

				<!-- v-else -->
				<view class="my-creation" v-else>
					<view class="my-creation-item">
						<view style="border-radius: 10px" v-if="item.gxdzList && item.gxdzList[0]">
							<uv-image @click="handleImageClick(item.gxdzList[0].synthesisImg)" radius="10rpx"
								style="border-radius: 10px" mode="aspectFill" :src=" item.gxdzList[0].synthesisImg"
								width="100%" height="400rpx"></uv-image>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item.gxdzList[0])" src="/static/images/zhuanfa1.png"
								width="48rpx" height="48rpx"></uv-image>


							<uv-image v-if='item.gxdzList && item.gxdzList[0].isCollect ==1'
								@click="collectFun(item.gxdzList[0])" src="/static/images/shoucang4.png" width="48rpx"
								height="48rpx"></uv-image>
							<uv-image v-else src="/static/images/shoucang3.png" width="48rpx" height="48rpx"
								@click="collectFun(item.gxdzList[0])"></uv-image>
							<uv-image @click="downloadFile(item.gxdzList[0])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>
					<view class="my-creation-item">
						<view v-if="item.gxdzList && item.gxdzList[1]">
							<uv-image @click="handleImageClick(item.gxdzList[1].synthesisImg)" radius="10rpx"
								style="border-radius: 10px" mode="aspectFill" :src=" item.gxdzList[1].synthesisImg"
								width="100%" height="400rpx"></uv-image>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item)" src="/static/images/zhuanfa1.png" width="48rpx"
								height="48rpx"></uv-image>
							<uv-image v-if='item.gxdzList && item.gxdzList[1].isCollect == 1'
								@click="collectFun(item.gxdzList[1])" src="/static/images/shoucang4.png" width="48rpx"
								height="48rpx"></uv-image>
							<uv-image v-else src="/static/images/shoucang3.png" width="48rpx" height="48rpx"
								@click="collectFun(item.gxdzList[1])"></uv-image>

							<uv-image @click="downloadFile(item.gxdzList[1])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>
				</view>
				<view
					v-if="item.gxdzList.length > 0 &&item.gxdzList[0]&& item.gxdzList[0].generateState && (item.gxdzList[0].generateState == 0 || item.gxdzList[1].generateState == 0)"
					style="width: 100%;box-sizing: border-box;"
					class="flex bgMinor5 ptb-21 plr-36 size-24 color-black4 radius-blr-16">
					<view class="flex" @click="regeneration(item)">
						<uv-image src="/static/images/refresh.png" width="35rpx" height="35rpx"></uv-image>
						<view class="ml-12">再次生成</view>
					</view>
					<view class="">时间：{{item.createTime}}</view>
				</view>
				<view
					v-if="item.gxdzList.length > 0 && (item.gxdzList[0].generateState != 0 || item.gxdzList[1].generateState != 0)"
					style="width: 100%;box-sizing: border-box;"
					class="flex bgMinor5 ptb-21 plr-36 size-24 color-black4 radius-blr-16">
					<view class="flex">
						<uv-image src="/static/images/refresh.png" width="35rpx" height="35rpx"></uv-image>
						<view class="ml-12">再次生成</view>
					</view>
					<view class="">时间：{{item.createTime}}</view>
				</view>
			</view>

			<!-- <view class="mt-24">
						<view class="listClass bgWhite plr-24 pt-20 radius-tlr-16">
							<view v-for="(item, index) in 6" class="">
								<view class="bgMinor hidden renClass radius-16 center" style="width: 202rpx; height: 270rpx">
								</view>
								<view class="plr-12 mt-15 flex">
									<uv-image src="/static/images/zhuanfa1.png" width="32rpx" height="32rpx"></uv-image>
									<uv-image src="/static/images/shoucang3.png" width="32rpx" height="32rpx"></uv-image>
									<uv-image src="/static/images/xiazai1.png" width="32rpx" height="32rpx"></uv-image>
								</view>
							</view>
						</view>
						<view class="flex bgMinor5 ptb-21 plr-36 size-24 color-black4 radius-blr-16">
							<view class="flex">
								<uv-image src="/static/images/refresh.png" width="35rpx" height="35rpx"></uv-image>
								<view class="ml-12">再次生成</view>
							</view>
							<view class="">时间：05:21</view>
						</view>
					</view> -->
		</view>
		<view  v-else-if="dataInfo.types == 'd' &&  dataInfo.records && dataInfo.records.length> 0  " 
			style="	background: #fff;border-radius: 16rpx;display: flex;flex-wrap: wrap;">

			<view v-for="(item, index) in dataInfo.records" :key="index" style="padding: 20rpx 5rpx 10rpx 20rpx;">
				<!-- 0:合成中 1:已合成 -->
				<view v-if="item.generateState ==0">
					<view class="my-creation-item">
						<view style="border-radius: 10px">
							<view
								style="width: 100%;color: rgb(184,177,178);height:  400rpx;background: rgb(246,246,246);border-radius: 16rpx;display: flex;justify-content: center;align-items: center;">
								正在合成...
							</view>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item.gxdzList[0])" src="/static/images/zhuanfa1.png"
								width="48rpx" height="48rpx"></uv-image>
							<uv-image src="/static/images/shoucang3.png" width="48rpx" height="48rpx"></uv-image>
							<uv-image @click="downloadFile(item.gxdzList[0])" src="/static/images/xiazai1.png"
								width="48rpx" height="48rpx"></uv-image>
						</view>
					</view>

				</view>

				<!-- v-else -->
				<view class="" v-else>
					<view class="my-creation-item" >
						<view style="border-radius: 10px;height: 228px;" v-if="item.synthesisImg ">
							<uv-image @click="handleImageClick(item.synthesisImg)" radius="10rpx"
								style="border-radius: 10px" mode="aspectFill" :src=" item.synthesisImg" width="100%"
								height="400rpx"></uv-image>
						</view>
						<view class="my-creation-item-tb">
							<uv-image @click="handleShare(item)" src="/static/images/zhuanfa1.png" width="48rpx"
								height="48rpx"></uv-image>

							<uv-image v-if='item && item.isCollect == 1' @click="collectFunLeft(item,0)"
								src="/static/images/shoucang4.png" width="48rpx" height="48rpx"></uv-image>
							<uv-image v-else src="/static/images/shoucang3.png" width="48rpx" height="48rpx"
								@click="collectFunLeft(item,0)"></uv-image>
							<uv-image @click="downloadFile(item)" src="/static/images/xiazai1.png" width="48rpx"
								height="48rpx"></uv-image>
						</view>
					</view>

				</view>
				<!-- <view v-if="item.name != 1" style="width: 100%;box-sizing: border-box;"
					class="flex bgMinor5 ptb-21 plr-36 size-24 color-black4 radius-blr-16">
					<view class="flex" @click="regeneration">
						<uv-image src="/static/images/refresh.png" width="35rpx" height="35rpx"></uv-image>
						<view class="ml-12">再次生成</view>
					</view>
					<view class="">时间：{{item.createTime}}</view>
				</view>
				<view v-if="item.name == 1" style="width: 100%;box-sizing: border-box;"
					class="flex bgMinor5 ptb-21 plr-36 size-24 color-black4 radius-blr-16">
					<view class="flex">
						<uv-image src="/static/images/refresh.png" width="35rpx" height="35rpx"></uv-image>
						<view class="ml-12">再次生成</view>
					</view>
					<view class="">时间：{{item.createTime}}</view>
				</view> -->
			</view>

			<!-- <view class="mt-24">
				<view class="listClass bgWhite plr-24 pt-20 radius-tlr-16">
					<view v-for="(item, index) in 6" class="">
						<view class="bgMinor hidden renClass radius-16 center" style="width: 202rpx; height: 270rpx">
						</view>
						<view class="plr-12 mt-15 flex">
							<uv-image src="/static/images/zhuanfa1.png" width="32rpx" height="32rpx"></uv-image>
							<uv-image src="/static/images/shoucang3.png" width="32rpx" height="32rpx"></uv-image>
							<uv-image src="/static/images/xiazai1.png" width="32rpx" height="32rpx"></uv-image>
						</view>
					</view>
				</view>
				<view class="flex bgMinor5 ptb-21 plr-36 size-24 color-black4 radius-blr-16">
					<view class="flex">
						<uv-image src="/static/images/refresh.png" width="35rpx" height="35rpx"></uv-image>
						<view class="ml-12">再次生成</view>
					</view>
					<view class="">时间：05:21</view>
				</view>
			</view> -->
		</view>

		<view v-else class=" mt-40" style="width: 100%;">
			<view
				style="font-size: 30rpx;width: 100%;text-align: center;  color: rgb(204, 204, 204);height: 25vh;display: flex;align-items: center;justify-content: center;width: 100%;">
				暂 无 数 据</view>
		</view>
		<view v-if="!dataInfo.hasMoreData"
			style="font-size: 30rpx;width: 100%;text-align: center;  color: rgb(204, 204, 204);height: 25vh;display: flex;align-items: center;justify-content: center;width: 100%;">
			没有更多数据了</view>
	</view>
</template>

<script setup lang="ts">
	import { baseURL } from '@/utils/config.ts';
	import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app';
	import { onMounted, reactive, ref, watch } from 'vue';
	import { getWindowHeight } from '@/pages/util/getHeight';
	import { addOpen, loggedIn, addOpenTab } from '@/pages/util/hooks';
	import useLoginStore from '@/pinia-store/userInfoStore';
	import { get, post, baseConfig } from '../../../utils/request';
	const useLogin = useLoginStore();
	const windowHeight = getWindowHeight() - 44 - 24;
	// console.log('useLoginuseLogin',useLogin);
	const { type, tabs } = withDefaults(
		defineProps<{
			type : String;
			tabs : String;
			// info: Array<T>;
		}>(),
		{
			type: () => 'b',
			tabs: () => '1' // 默认值 a一键换装 b个性定制
			// info: () => null // 复杂数据类型使用函数返回的方式
		}
	);




	/** @name 数据 */
	const dataInfo = reactive({
		types: type,
		records: [],
		hasMoreData: true,
		timerId: null,
		recommend: [],
		total: 0,
		pages: 0,
		isLoading: false,
		pageNo: 1,
	});

	const params = {
		pageNo: 1,
		pageSize: 1000
	}
	onReachBottom(() => {
		BottomFUN()
	})
	const BottomFUN = () => {
		if (!dataInfo.isLoading && dataInfo.hasMoreData) {

			if (dataInfo.pageNo < dataInfo.pages) {
				dataInfo.pageNo++;
				if (tabs == '1') {
					fetchDataTwo()
				} else {
					fetchData()
				}
			} else {
				dataInfo.hasMoreData = false
				setTimeout(() => {
					dataInfo.hasMoreData = true
				}, 800)
			}

			// this.fetchData();
		}
	}
	const fetchData = async (type : Number) => {


		try {
			const response = await get<{
				code : number;
				result : any;
				pageNo : Number,
				pageSize : Number,
				type : Number
			}>('customized/getList', { pageNo: dataInfo.pageNo, pageSize: 10, type: 1 });
			if (response.code == 200) {
			dataInfo.pages = response.result.pages
			dataInfo.total = response.result.total
			dataInfo.records = [...dataInfo.records,...response.result.records]
			let num = null
			// <!-- 0:合成中 1:已合成 -->
			dataInfo.records.forEach(item => {
				item.gxdzList.forEach((items) => {
					if (items && items.generateState == 0) {
						num = 0
					}
				})
			})
			console.log('----------------' + num)
			if (num == null) {
				clearInterval(dataInfo.timerId);
				uni.setStorageSync('information', false)
			} else {
				if (uni.getStorageSync('isinformation') == true) {
					uni.setStorageSync('isinformation', false)
					if (tabs == '1') {
						dataInfo.timerId = setInterval(fetchDataTwo, 15000);
						console.log("一件换装我的创做")
					} else {
						dataInfo.timerId = setInterval(fetchData, 15000);
					}
				}
			
			}
			console.log(dataInfo.records)
			
			
			
			if (type == 1) {
				uni.showToast({
					title: response.message,
					icon: 'success',
					duration: 2000
				});
			}
			} else {

			}




			// setTimeout(() => {
			// 	if (dataInfo.pageNo < dataInfo.pages) {
			// 		console.log("你加载了吗 ")
			// 		loadMoreData()
			// 	}
			// }, 1000);
		}
		catch (error) {
			console.error(error);
		}
	}

	const loadMoreData = () => {
		console.log('=======')
		if (!dataInfo.isLoading && dataInfo.hasMoreData) {

			console.log("有没有加载方法")
			if (dataInfo.pageNo < dataInfo.pages) {
				dataInfo.pageNo++;

				if (tabs == '2') {
					fetchData()
				} else {
					fetchDataTwo()
				}

			} else {
				dataInfo.hasMoreData = false
				setTimeout(() => {
					dataInfo.hasMoreData = true
				}, 800)
			}


		}
	};
	defineExpose({
		loadMoreData,
		BottomFUN

	});


	const fetchDataTwo = async (type : Number) => {


		try {
			const response = await get<{
				code : number;
				result : any;
				pageNo : Number,
				pageSize : Number,
				type : Number
			}>('replacement/getList', { pageNo: dataInfo.pageNo, pageSize: 10, type: 1 });
			if (response.code == 200) {
			dataInfo.pages = response.result.pages
			dataInfo.total = response.result.total
			dataInfo.records = [...dataInfo.records,...response.result.records]
			// if (uni.getStorageSync('dataList') && uni.getStorageSync('information') == true) {
			// 	let num = JSON.parse(uni.getStorageSync('dataList')).length
			// 	if (num <= dataInfo.records.length) {
			// 		// dataInfo.records.unshift({
			// 		// 	name: 1
			// 		// })
			// 	} else {
			// 		uni.setStorageSync('information', false)
			// 		clearInterval(dataInfo.timerId);
			// 	}
			// } else {
			// 	uni.setStorageSync('dataList', JSON.stringify(response.result.records))
			// }
			// generatestate
			let num = null
			// <!-- 0:合成中 1:已合成 -->
			dataInfo.records.forEach(item => {
				item.gxdzList.forEach((items) => {
					if (items.generateState == 0) {
						num = 0
					}
				})
			})
			console.log('----------------' + num)
			if (num == null) {
				clearInterval(dataInfo.timerId);
				uni.setStorageSync('information', false)
			} else {
				if (uni.getStorageSync('isinformation') == true) {
					uni.setStorageSync('isinformation', false)
					if (tabs == '1') {
						dataInfo.timerId = setInterval(fetchDataTwo, 15000);
						console.log("一件换装我的创做")
					} else {
						dataInfo.timerId = setInterval(fetchData, 15000);
					}
				}
			
			}
			console.log(dataInfo.records)
			
			
			
			if (type == 1) {
				uni.showToast({
					title: response.message,
					icon: 'success',
					duration: 2000
				});
			}
		}}
		catch (error) {
			console.error(error);
		}
	}



	const regeneration = async (item) => {
		console.log(item)
		const data = item;
		const response = await post<{
			data : object
		}>('customized/add', data);
		if (response) {

		}
		uni.showToast({
			title: '正在重新生成~',
			icon: 'success',
			duration: 1000
		});
		uni.setStorageSync('isinformation', true)
		if (tabs == '1') {
			fetchDataTwo()
		} else {
			fetchData()
		}
		// fetchData(1);
	}
	onMounted(() => {
		dataInfo.records = []
		console.log(type)
		if (tabs == '1') {
			fetchDataTwo()
			console.log("一件换装我的创做")
		} else {
			fetchData()
		}

		if (uni.getStorageSync('information') == true) {

			uni.setStorageSync('isinformation', true)


		}

	});

	const downloadUrl = ref('https://example.com/yourfile.pdf'); // 替换为实际的文件下载链接


	const downloadFile = async (item : { synthesisImg : any; }) => {
		try {
			// 开始下载文件
			const downloadTask = uni.downloadFile({
				url: item.synthesisImg,

				success: (res) => {
					if (res.statusCode === 200) {
						// 检查文件类型是否为图片
						const fileType = res.tempFilePath.split('.').pop()?.toLowerCase();
						if (['jpg', 'jpeg', 'png', 'gif'].includes(fileType || '')) {
							// 保存图片到相册
							uni.saveImageToPhotosAlbum({
								filePath: res.tempFilePath,
								success: () => {
									uni.showToast({
										title: '图片已保存到相册',
										icon: 'success',
									});
								},
								fail: (err) => {
									uni.showToast({
										title: '保存到相册失败',
										icon: 'none',
									});
									console.error('保存到相册失败:', err);
								},
							});
						} else {
							uni.showToast({
								title: '仅支持图片保存到相册',
								icon: 'none',
							});
						}
					} else {
						uni.showToast({
							title: '文件下载失败',
							icon: 'none',
						});
						console.error('文件下载失败，状态码:', res.statusCode);
					}
				},
				fail: (err) => {
					uni.showToast({
						title: '文件下载失败',
						icon: 'none',
					});
					console.error('文件下载失败:', err);
				},
			});

			// 监听下载进度
			downloadTask.onProgressUpdate((progressRes) => {
				console.log('下载进度:', progressRes.progress);
			});
		} catch (error) {
			uni.showToast({
				title: '文件下载出错',
				icon: 'none',
			});
			console.error('文件下载出错:', error);
		}
	};

	// 分享图片
	let synthesisImg = ''
	const collectFun = async (val) => {

		try {
			const response = await post<{
				id : Number;
				type : String
			}>('/collect/add', { imgId: val.id, type: 0 });
			if (response) {
				if (tabs == '1') {
					fetchDataTwo()
				} else {
					fetchData()
				}

				// particularsFun({ id: dataInfo.id })
			}

		} catch (error) {
			console.error(error);
		}
	};
	const collectFunLeft = async (vals) => {
		// (0:收藏 1:喜欢 2:下载)"
		// if (val == 0) {
		// 	dataInfo.shouAi = !dataInfo.shouAi
		// } else if (val == 1) {
		// 	dataInfo.kongAi = !dataInfo.kongAi
		// }
		try {
			const response = await post<{
				id : Number;
				type : String
			}>('/collect/add', { imgId: vals.id, type: 0 });
			if (response) {
				if (tabs == '1') {
					fetchDataTwo()
					console.log("一件换装我的创做")
				} else {
					fetchData()
				}

				// particularsFun({ id: dataInfo.id })
			}

		} catch (error) {
			console.error(error);
		}
	};
	const handleShare = async (item : { synthesisImg : string; }) => {
		try {
			console.log(item)

			const response = await post<{
				id : Number;
			}>('/replacement/release', { id: item.id });
			if (response) {
				uni.showToast({
					title: '操作成功',
					icon: 'error',
					duration: 1000
				});
				// particularsFun({ id: id.id })
				// dataInfo.imgUrl = response.result.imgUrl
				// dataInfo.dzNum = response.result.dzNum
				// dataInfo.scNum = response.result.scNum
				// dataInfo.id = response.result.id

			}
			// let localImagePath = item.synthesisImg;
			// synthesisImg = item.synthesisImg;
			// 若为网络图片，需要先下载到本地
			// if (item.synthesisImg.startsWith('http')) {
			// 	const { tempFilePath } = await uni.downloadFile({ url: item.synthesisImg });
			// 	localImagePath = tempFilePath;
			// }

			// // 调用 showShareImageMenu 唤起分享菜单
			// uni.showShareImageMenu({
			// 	path: localImagePath,
			// 	success: () => {
			// 		uni.showToast({
			// 			title: '唤起分享菜单成功',
			// 			icon: 'success'
			// 		});
			// 	},
			// 	fail: (err) => {
			// 		uni.showToast({
			// 			title: '唤起分享菜单失败',
			// 			icon: 'none'
			// 		});
			// 		console.error('唤起分享菜单失败:', err);
			// 	}
			// });
		} catch (error) {
			uni.showToast({
				title: '操作出错',
				icon: 'none'
			});
			console.error('操作出错:', error);
		}
	};

	const onShareAppMessage = () => {
		return {
			title: '分享图片',
			path: '/pages/index/index',
			imageUrl: synthesisImg.value
		};
	};

	// 定义页面分享到朋友圈的配置
	const onShareTimeline = () => {
		return {
			title: '分享图片',
			query: '',
			imageUrl: synthesisImg.value
		};
	};

	/** @name xxx */
	async function getUserInfo() { }

	const handleImageClick = (currentImage : string) => {
		// 确保图片列表有效
		if (!currentImage) return;

		uni.previewImage({
			urls: [currentImage], // 仅包含第0位的数组
			current: currentImage,
			indicator: 'none' // 隐藏预览指示器（可选，单图时通常不需要）
		});
	};
</script>

<style scoped lang="scss">
	// :deep(.checklist-box) {
	// 	//  模版
	// }
	.listClass {
		display: grid;
		// grid-template-columns: ;
		grid-template-columns: repeat(3, 1fr);
		/* 分为三列，每列宽度相等 */
		// gap: 24rpx;
		// row-gap: 24rpx;
		column-gap: 24rpx;
	}

	.closeClass {
		position: absolute;
		right: 24rpx;
		top: 24rpx;
	}

	// 按钮
	.list_b_btn {
		letter-spacing: 3rpx;
		background: -webkit-linear-gradient(left top, #ffc800, #ff0053, #ff5037); // , 100%,#ff5037 left top,
	}

	.my-creation {
		width: 690rpx;
		margin: 20rpx auto 0rpx;
		border-radius: 10rpx 10rpx 0rpx 0rpx;
		background: #ffffff;
		padding: 20rpx 20rpx 0rpx;

		display: flex;
		flex-wrap: wrap;
		box-sizing: border-box;
	}

	.my-creation-item {
		width: 325rpx;
		padding: 10rpx;
		// margin: 10rpx;
		box-sizing: border-box;
		// height: 400rpx;
	}

	.my-creation-item-tb {
		display: flex;
		// margin-top: 20rpx;
		padding: 15rpx 10rpx 5rpx;
		box-sizing: border-box;
		justify-content: space-between;
	}
</style>